﻿using databaseoper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication
{
    public partial class Index : System.Web.UI.Page
    {
        /// <summary>
        /// 热门产品数量
        /// </summary>
        public int HotProductCount = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            HotProducts();
        }

        protected void HotProducts()
        {
            string sql = "SELECT top(4) * FROM Products order by views desc";
            DataSet data = SQLHelper.ExecuteDataset(SQLHelper.connStr, CommandType.Text, sql);
            if (data != null)
            {
                HotProductCount = data.Tables[0].Rows.Count;
                Products.DataSource = data.Tables[0];
                Products.DataBind();

            }

        }
    }
}